package com.example.nacosConsumer.fallback;

import com.example.nacosConsumer.entity.Customer;
import com.example.nacosConsumer.service.ConsumerService;

/**
 * 服务降级
 */
public class ConsumerServiceFallback implements ConsumerService {

    private Throwable throwable;

    ConsumerServiceFallback(Throwable throwable) {
        this.throwable = throwable;
    }

    /**
     * 调用服务提供方的输出接口
     *
     * @param name 用户输入
     * @return string
     */
    @Override
    public String hello(String name) {
        return "cunsumer-fallback-default-name " + throwable.getMessage();
    }

    @Override
    public String insertInfo(Customer customer) {
        return "cunsumer-fallback-default-insertInfo " + throwable.getMessage();
    }
}
